<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/views/wx/include/head.jsp" %>
<style>p{color:#000000;}</style>
</head>
<body>
	<header class="mui-bar mui-bar-nav">
		<a onclick="window.location.href='${ctxWx}/d/realschevehi/taskList';" class="mui-icon mui-icon-reload mui-pull-left"></a>
		<button onclick="window.location.href='${ctxWx}/d/realschevehi/history';" class="mui-btn mui-btn-blue mui-btn-link mui-pull-right">历史记录</button>
		<h1 class="mui-title">发车计划</h1>
	</header>
	<div class="mui-content">
		<c:choose>
			<c:when test="${not empty realscheVehiList }">
				<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed">
					<c:forEach items="${realscheVehiList }" var="realscheVehi">
						<c:choose>
							<c:when test="${realscheVehi.orders.ordertype == ORDER_TYPE_REALSCHE_SELF_TRAVEL}">
								<%-- vehiType为1表示班次车，为2表示整车 --%>
								<c:set var="vehiType" value="1"/>
							</c:when>
							<c:otherwise>
								<c:set var="vehiType" value="2"/>
							</c:otherwise>
						</c:choose>
						<li class="mui-table-view-cell"
							<c:if test="${vehiType == 1 }">
								onclick="window.location.href='${ctxWx}/d/realschevehi/order?realvehiid=${realscheVehi.realvehiid }';"
							</c:if>
							<%-- <c:if test="${vehiType == 2 and realscheVehi.drvconfirmed == '1' }">
								onclick="window.location.href='${ctxWx}/d/realschevehi/settle?realvehiid=${realscheVehi.realvehiid }';"
							</c:if> --%>>
							<p style="margin-bottom:10px;">
								<a>${realscheVehi.orders.ordername }</a>
								<c:if test="${vehiType == 1 }">
									<span class="mui-badge mui-badge-warning">待发车</span>
								</c:if>
							</p>
							<div class="mui-pull-left">
								<p>出发时间:<fmt:formatDate value="${realscheVehi.departtime }" pattern="MM月dd日 E" /></p>
								<p>上车点：${realscheVehi.orders.boardaddr }</p>
								<%-- <p>下车点：${realscheVehi.orders.offaddr }</p> --%>
								<p>上车时间：<fmt:formatDate value="${realscheVehi.departtime }" pattern="HH:mm" /></p>
								<p>行程描述：${realscheVehi.orders.remarks }</p>
								<p>车牌号:${realscheVehi.licno }</p>
								<p>包车人姓名：${realscheVehi.orders.contacts }</p>
								<p>包车人电话：${realscheVehi.orders.payertel }</p>
								<p>现收金额：${realscheVehi.orders.dueamount }</p>
							</div>
							<div class="mui-pull-right">
								<c:if test="${vehiType == 2 }">
									<c:if test="${realscheVehi.drvconfirmed == '0' }">
										<button onclick="pick('${realscheVehi.realvehiid }');" class="mui-btn mui-btn-primary">接单</button>
									</c:if>
									<c:if test="${realscheVehi.drvconfirmed == '1' }">
										<button onclick="over('${realscheVehi.realvehiid }');" class="mui-btn mui-btn-warning">完单</button>
									</c:if>
								</c:if>
							</div>
						</li>
					</c:forEach>
				</ul>
				<div class="mui-content-padded">${page.wxhtml }</div>
			</c:when>
			<c:otherwise>
				<p class="nodata-tip">没有查到信息</p>
			</c:otherwise>
		</c:choose>
	</div>
	<%@ include file="/WEB-INF/views/wx/include/script.jsp"%>
	<script>
		function pick(realvehiid) {
			var btnArray = ['否', '是'];
			mui.confirm('是否确认接单？', '警告', btnArray, function(e) {
				if (e.index == 1) {
					window.location.href='${ctxWx}/d/realschevehi/pick?realvehiid='+realvehiid;
				}
			})
		}
		function over(realvehiid) {
			var btnArray = ['否', '是'];
			mui.confirm('是否确认完单？', '警告', btnArray, function(e) {
				if (e.index == 1) {
					window.location.href='${ctxWx}/d/realschevehi/over?realvehiid='+realvehiid;
				}
			})
		}
	</script>
</body>
</html>